<?php

namespace app\api\controller;

use app\api\service\VideoService;
use app\api\validate\VideoValidate;

class Video extends Base
{
    protected $middleware = ['NotFoundMiddleware'];

    /**
     * 获取推荐视频
     * @needLogin FALSE
     * @method GET
     * @return void
     */
    public function getRecommendList()
    {
        list($code, $msg, $data) = VideoService::getRecommendList($this->params);
        apiReturn($code, $msg, $data);
    }

    /**
     * 获取视频列表
     * @needLogin FALSE
     * @method GET
     * @return void
     */
    public function getVideoList()
    {
        if (($msg = VideoValidate::getVideoList($this->params)) !== true) apiReturn(201, $msg);
        list($code, $msg, $data) = VideoService::getVideoList($this->params);
        apiReturn($code, $msg, $data);
    }

    /**
     * 获取视频详情
     * @needLogin TRUE
     * @method GET
     * @return void
     */
    public function getVideoInfo()
    {
        if (($msg = VideoValidate::getVideoInfo($this->params)) !== true) apiReturn(201, $msg);
        list($code, $msg, $data) = VideoService::getVideoInfo($this->params);
        apiReturn($code, $msg, $data);
    }
}